package com.elong.businesstravel.protocol.order;

import java.util.ArrayList;
import java.util.List;

import org.apache.http.Header;
import org.json.JSONArray;
import org.json.JSONObject;

import com.elong.businesstravel.entitys.Bank;
import com.elong.businesstravel.protocol.baseresponse.BaseELongJsonHttpResponse;

public class GetBankListResponse extends BaseELongJsonHttpResponse {

	public List<Bank> banks  = new ArrayList<Bank>();
	
	@Override
	public void onSuccess(int statusCode, Header[] headers,
			JSONObject mainJsonObject) throws Throwable {
		JSONArray responseJsonArray = mainJsonObject.optJSONArray("response");
		for (int i = 0; i < responseJsonArray.length(); i++) {
			JSONObject itemJsonObject = responseJsonArray.optJSONObject(i);
			Bank bank = new Bank();
			bank.Name = itemJsonObject.optString("Name", "");
			bank.Value = itemJsonObject.optString("Value", "");
			bank.isCVV = itemJsonObject.optString("isCVV", "");
			banks.add(bank);
		}
	}

}
